using System;

namespace SellAvi.Classes
{
    public class AvitoTaskStatus
    {
        public delegate void ResolveConflictDelegate();
        private bool _operationSucceeded = false;
        private bool _operationRepeatNeeded = false;
        private int _operationStepNumber = 0;
        private string _operationMessage;

        public AvitoTaskStatus()
        {
            OperationStartTime = new DateTime();
        }

        public bool OperationSucceeded
        {
            get { return _operationSucceeded; }
            set { _operationSucceeded = value; }
        }

        public bool OperationRepeatNeeded
        {
            get { return _operationRepeatNeeded; }
            set { _operationRepeatNeeded = value; }
        }
        public int OperationStepNumber
        {
            get { return _operationStepNumber; }
            set { _operationStepNumber = value; }
        }

        public int? ErrorCode { get; set; }

        public string OperationMessage
        {
            get { return (ErrorCode == null) ? _operationMessage : PublicationMessages.ErrorCodes[(int)ErrorCode]; }
            set { _operationMessage = value; }
        }

        public DateTime OperationStartTime { get; set; }
        public ResolveConflictDelegate TryToResolveMethod { get; set; }
    }
}